/**
 * Created by Yu Jin Xian on 2016/12/14.
 */
var express = require('express');
var handlebars = require('express3-handlebars').create({defaultLayout: 'main'});

var app = express();
app.engine('handlebars', handlebars.engine);
app.set('view engine', 'handlebars');

app.get('/nursery-rhyme', function (req, res) {
    res.render('nursery-rhyme');
});

app.get('/data/nursery-rhyme', function (req, res) {
    res.json({
        animal: 'basilisk',
        bodyPart: 'tail',
        adjective: 'sharp',
        noun: 'a needle'
    });
});

app.listen(3000, function () {
    console.log('http://localhost:3000/nursery-rhyme');
});